<template>
  <view class="rechargeDetail">
    <topTitle :title="$t('rechargeDetail.title')" />
    <view class="list" v-if="UsersRechargeOrderList.length">
      <view v-for="(item, idx) in UsersRechargeOrderList" :key="idx">
        <view>
          <view>{{ item.order_no }}</view>
          <view class="operation_account">
            {{ item.operation_account == 2 ? $t('rechargeDetail.accountType.quantitative') : $t('rechargeDetail.accountType.smart') }}
          </view>
        </view>
        <view>
          <view>{{ item.money }}USDT</view>
          <view class="time">{{ formattingTime(item.add_time) }}</view>
        </view>
      </view>
    </view>
    <noData v-else />
  </view>
</template>
<script setup lang="ts">
import { ref, getCurrentInstance } from "vue";
import { onShow, onReachBottom } from "@dcloudio/uni-app";
const instance = getCurrentInstance()?.appContext.config.globalProperties;
import { UsersRechargeOrder } from "@/api/UserApi";

let UsersRechargeOrderList = ref<Array<any>>([]);
let select_time: any = null;
const UsersRechargeOrderFn = async () => {
	let list = await UsersRechargeOrder({
		select_time,
	});
	if (!select_time) {
		UsersRechargeOrderList.value = list;
	} else {
		UsersRechargeOrderList.value = [...UsersRechargeOrderList.value, ...list];
	}
};


onShow(() => {
	UsersRechargeOrderFn()
})
onReachBottom(() => {
	select_time = UsersRechargeOrderList.value[UsersRechargeOrderList.value.length - 1].add_time;
	UsersRechargeOrderFn();
});
</script>

<style scoped lang="scss">
@import "../../static/scss/rechargeDetail.scss";
</style>